package com.wbao.dianniu.ui;

import android.app.Activity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;

import com.umeng.analytics.MobclickAgent;
import com.wbao.dianniu.data.Martis;
import com.wbao.dianniu.utils.Utils;
import com.wbao.dianniu.R;

/**
 * 查看图片
 * 
 * @author yejianjun
 *
 */
public class ImageActivity extends Activity implements OnTouchListener{
	
	private ImageView mImageView;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.view_image);
		mImageView = (ImageView) findViewById(R.id.image_review);
		//获取屏幕宽高
		Martis martis = Utils.getMetrics(getWindowManager());
		LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
		lp.width =martis.getWidth();
		lp.height = martis.getWidth();
		mImageView.setLayoutParams(lp);
		mImageView.setBackgroundResource(R.drawable.default_head_icon);
		RelativeLayout rl = (RelativeLayout) findViewById(R.id.image_review_rl);
		//rl.addView(mImageView);
		rl.setGravity(Gravity.CENTER_VERTICAL);
	}
	@Override
	public boolean onTouch(View v, MotionEvent event) {
		this.finish();
		return true;
	}
	public void onResume() {
		super.onResume();
		MobclickAgent.onResume(this);
		}
		public void onPause() {
		super.onPause();
		MobclickAgent.onPause(this);
		}

}
